from sqlalchemy import Column, Integer, String, Boolean, ForeignKey
from sqlalchemy.orm import relationship
from datetime import datetime
from auth.db import Base
class Device(Base):
    __tablename__ = "devices"

    id = Column(Integer, primary_key=True, index=True)
    device_id = Column(String(64), unique=True, index=True, nullable=False)   # ✅ 指定长度
    name = Column(String(100), nullable=True)                                 # ✅ 指定长度
    owner = Column(String(50), nullable=True)                                 # ✅ 指定长度
    online = Column(Boolean, default=False)
    created_at = Column(String(50), default=datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
